/*********************\
* Author:Dzlua
* QQ:505544956
* Time:2017/04/15
\**********************/
#include "LuaListEx.h"

#define CObjPtr ((CListExUI*)m_cobj)

namespace DuiLib {

BOOL LuaListEx::CheckColumEditable(int nColum)
{
    return CObjPtr->CheckColumEditable(nColum);
}

int LuaListEx::GetEditUI(LuaState *L)
{
    CEditUI* ctrl = CObjPtr->GetEditUI();
    LuaHelperNS::PushCObj(L, ctrl);
    return 1;
}

BOOL LuaListEx::CheckColumComboBoxable(int nColum)
{
    return CObjPtr->CheckColumComboBoxable(nColum);
}

int LuaListEx::GetComboBoxUI(LuaState *L)
{
    CComboBoxUI* ctrl = CObjPtr->GetComboBoxUI();
    LuaHelperNS::PushCObj(L, ctrl);
    return 1;
}

BOOL LuaListEx::CheckColumCheckBoxable(int nColum)
{
    return CObjPtr->CheckColumCheckBoxable(nColum);
}

void LuaListEx::SetEditRowAndColum(int nRow,int nColum)
{
    CObjPtr->SetEditRowAndColum(nRow, nColum);
}

void LuaListEx::SetColumItemColor(int nIndex, int nColum, DWORD iBKColor)
{
    CObjPtr->SetColumItemColor(nIndex, nColum, iBKColor);
}

int LuaListEx::GetColumItemColor(LuaState *L)
{
    LuaStack args(L);
    int nIndex = LuaHelperNS::GetInt(args[2], -1);
    int nColum = LuaHelperNS::GetInt(args[3], -1);
    DWORD iBKColor = 0;
    BOOL iRet = CObjPtr->GetColumItemColor(nIndex, nColum, iBKColor);
    L->PushInteger(iRet);
    L->PushInteger(iBKColor);
    return 2;
}

SDLUA_BEGIN_REGISTER(LuaListEx, ListEx, List)
    SDLUA_REGISTER_FUN_CPP(LuaListEx, CheckColumEditable, CheckColumEditable)
    SDLUA_REGISTER_FUN_LUA(LuaListEx, GetEditUI, GetEditUI)
    SDLUA_REGISTER_FUN_CPP(LuaListEx, CheckColumComboBoxable, CheckColumComboBoxable)
    SDLUA_REGISTER_FUN_LUA(LuaListEx, GetComboBoxUI, GetComboBoxUI)
    SDLUA_REGISTER_FUN_CPP(LuaListEx, CheckColumCheckBoxable, CheckColumCheckBoxable)
    SDLUA_REGISTER_FUN_CPP(LuaListEx, SetEditRowAndColum, SetEditRowAndColum)
    SDLUA_REGISTER_FUN_CPP(LuaListEx, SetColumItemColor, SetColumItemColor)
    SDLUA_REGISTER_FUN_LUA(LuaListEx, GetColumItemColor, GetColumItemColor)
SDLUA_END_REGISTER

SDLUA_BEGIN_UNREGISTER(LuaListEx, ListEx)
SDLUA_END_UNREGISTER(ListEx)

}

#undef CObjPtr